load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library")
load("@fbcode_macros//build_defs:cpp_unittest.bzl", "cpp_unittest")
load("@fbcode_macros//build_defs:thrift_library.bzl", "thrift_library")

oncall("fboss_agent_push")

cpp_library(
    name = "lldp",
    srcs = [
        "LinkNeighbor.cpp",
        "LinkNeighborDB.cpp",
    ],
    headers = [
        "LinkNeighbor.h",
        "LinkNeighborDB.h",
        "Lldp.h",
        "lldp_thrift_types.h",
    ],
    exported_deps = [
        ":lldp_structs-cpp2-reflection",
        ":lldp_structs-cpp2-types",
        "//fboss/agent:agent_features",
        "//fboss/agent:fboss-types",
        "//fboss/thrift_cow/nodes:nodes",
        "//fboss/thrift_cow/storage:cow_storage",
        "//folly:conv",
        "//folly:network_address",
        "//folly:range",
        "//folly:string",
        "//folly:synchronized",
        "//folly/io:iobuf",
        "//folly/logging:logging",
        "//thrift/lib/cpp2:type_class",
    ],
    exported_external_deps = ["glog"],
)

cpp_unittest(
    name = "lldp_tests",
    srcs = [
        "test/LinkNeighborDBTest.cpp",
        "test/LinkNeighborTest.cpp",
    ],
    deps = [
        ":lldp",
        "//fboss/agent/packet:pktutil",
        "//folly/io:iobuf",
    ],
)

thrift_library(
    name = "lldp_structs",
    go_thrift_namespaces = {
        "lldp.thrift": "facebook.fboss.lldp",
    },
    languages = [
        "cpp2",
        "go",
        "py-deprecated-asyncio",
        "py3-deprecated",
        "rust",
        "py-deprecated",
        "python",
    ],
    no_plugin_deps = ["//thrift/annotation:all"],
    py3_namespace = "neteng.fboss.lldp",
    py_asyncio_base_module = "neteng.fboss.asyncio",
    py_base_module = "neteng.fboss",
    thrift_cpp2_options = "json,reflection",
    thrift_py_options = "json,sort_keys",
    thrift_rust_options = [
        "deprecated_default_enum_min_i32",
        "serde",
    ],
    thrift_srcs = {"lldp.thrift": []},
)
